<?php

require 'utilsBD.php';
require 'utils.php';

$q = strtolower($_GET["q"]);
if (!$q) return;
connect();
$requete = "SELECT * FROM `User` WHERE nom like \"%$q%\" OR prenom like \"%$q%\";";
$reponse = executerRequete($requete, $GLOBALS['debug']);
$i=0;
$items = array();

while ($donnees = mysql_fetch_array($reponse))
    {
        $items[$i][0]=$donnees['pseudo'];
        $items[$i][1]=$donnees['prenom'];
        $items[$i][2]=$donnees['nom'];
        $caution=date('d/m/Y',convertirDate($donnees['caution']));
        
        if((convertirDate($donnees['caution']) + 31622400) < time()){
            $caution ="<font color='red'>{$caution}</font>";
        }
        $items[$i][3]=$caution;
        $items[$i][4]=$donnees['niveau'];
        $i++;

    }



foreach ($items as $v) {

	if (strpos(strtolower($v[0]), $q) !== false OR strpos(strtolower($v[1]), $q) !== false OR strpos(strtolower($v[2]), $q) !== false) {
		echo "$v[0]|$v[1]|$v[2]|$v[3]|$v[4]\n";
	}
    
}
mysql_close();



?>